package com.wanxi.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

@WebServlet("/a")
public class TestServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding(StandardCharsets.UTF_8.toString());
//        String method = req.getMethod();
//        System.out.println(method);
//
//        System.out.println(req.getContextPath());
//        System.out.println(req.getRequestURL());
//        System.out.println(req.getRequestURI());
//        System.out.println(req.getQueryString());
//        System.out.println("=============");

//        System.out.println(req.getHeader("Connection"));
        String username = req.getParameter("username");
        System.out.println(username);
        String password = req.getParameter("password");
        req.getRequestDispatcher("/index.jsp").forward(req, resp);

    }
}
